package com.living.player.dialog;

import android.graphics.Color;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadListener;
import com.liulishuo.filedownloader.FileDownloadSampleListener;
import com.living.Constant;
import com.living.R;
import com.living.filedownloader.bean.TasksManagerModel;
import com.md.basedpc.persistence.PHSPUtil;
import com.md.network.api.Audio;

import org.jetbrains.annotations.NotNull;

import java.util.Map;

/***
 * 下载适配器
 */
public class RecentPlayListAdapter extends BaseQuickAdapter<Audio, BaseViewHolder> {


    public RecentPlayListAdapter() {
        super(R.layout.item_recent_playlist);
        addChildClickViewIds(R.id.iv_player_recent_delete);
    }

    @NotNull
    @Override
    protected BaseViewHolder onCreateDefViewHolder(@NotNull ViewGroup parent, int viewType) {
        BaseViewHolder holder = super.onCreateDefViewHolder(parent, viewType);
        return holder;
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, Audio model) {
        if (model == null) return;
        holder.setText(R.id.tv_player_recent_name, model.getName() + "");
        holder.setText(R.id.tv_player_recent_id, model.getId());
        if (PHSPUtil.getInstance().getString(Constant.player_recent_audio_id, "").equals(model.getId())) {
            holder.setTextColor(R.id.tv_player_recent_id, Color.parseColor("#12C286"));
            holder.setTextColor(R.id.tv_player_recent_name, Color.parseColor("#12C286"));
        } else {
            holder.setTextColor(R.id.tv_player_recent_id, Color.parseColor("#757575"));
            holder.setTextColor(R.id.tv_player_recent_name, Color.parseColor("#262626"));
        }
    }


}
